#!/bin/bash
source /etc/profile;

function listenPort ()
{
  local HOST_STR=$1
  local PORT_VAL=$2
if nc -z "$HOST_STR" "$PORT_VAL"; then
 return 1;
else
   return 0;
fi

}


i=100

for ((i=0;i<=100;i+=2))
do
sleep 1s;
 listenPort "localhost" "8080"
v=$?;
if  [ "$v" = "1" ];
then break;
else
  echo "wait 8080 listen  $i";
fi;

done
echo "start finished"

